#ifndef _MOE_POPULATION
#define _MOE_POPULATION

#include "engine/ArrayList.hh"
#include "engine/Solution.hh"

/** This class implements a population of individuals
 * Population it's a key concept in evolutionary computing, it represents a
 * set of individuals that evolve inside the alghorithm
 */

class Population {

private:

    ArrayList<Solution> *solutions;
    double sum;

public:

    Population();

    Population(ArrayList<Solution> *solutions);

    virtual ~Population();

    /**replace the current set of individuals
      *please consider that the new individuals do not get copied, so when
      *this method return the callee still has references to the population,
      *and population instance it's owner of the solutions, so not be carefull
      *with those references it's a certain source of segmentation fault errors
      *@param newSolutions are the new individuals
      */
    virtual void replace(ArrayList<Solution> *newSolutions);

    Solution* get(int i);

    /**@return a copy of the set of individuals in the population*/
    ArrayList<Solution>* getAll();

    /**@return the pareto front of the population*/
    ArrayList<Solution>* getParetoFront();

    int length();

    double getSum();

    void updateSum();

};

#endif
